/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Protection.impl;

import EA_Model.IEC61970.Core.impl.IdentifiedObjectImpl;

import EA_Model.IEC61970.Domain.Seconds;

import EA_Model.IEC61970.Protection.ProtectionPackage;
import EA_Model.IEC61970.Protection.RecloseSequence;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Reclose Sequence</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.RecloseSequenceImpl#getRecloseDelay <em>Reclose Delay</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.RecloseSequenceImpl#getRecloseStep <em>Reclose Step</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RecloseSequenceImpl extends IdentifiedObjectImpl implements RecloseSequence {
	/**
	 * The cached value of the '{@link #getRecloseDelay() <em>Reclose Delay</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRecloseDelay()
	 * @generated
	 * @ordered
	 */
	protected Seconds recloseDelay;

	/**
	 * The cached value of the '{@link #getRecloseStep() <em>Reclose Step</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRecloseStep()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Integer recloseStep;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RecloseSequenceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProtectionPackage.Literals.RECLOSE_SEQUENCE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getRecloseDelay() {
		if (recloseDelay != null && recloseDelay.eIsProxy()) {
			InternalEObject oldRecloseDelay = (InternalEObject)recloseDelay;
			recloseDelay = (Seconds)eResolveProxy(oldRecloseDelay);
			if (recloseDelay != oldRecloseDelay) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY, oldRecloseDelay, recloseDelay));
			}
		}
		return recloseDelay;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetRecloseDelay() {
		return recloseDelay;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRecloseDelay(Seconds newRecloseDelay) {
		Seconds oldRecloseDelay = recloseDelay;
		recloseDelay = newRecloseDelay;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY, oldRecloseDelay, recloseDelay));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer getRecloseStep() {
		if (recloseStep != null && recloseStep.eIsProxy()) {
			InternalEObject oldRecloseStep = (InternalEObject)recloseStep;
			recloseStep = (EA_Model.IEC61970.Domain.Integer)eResolveProxy(oldRecloseStep);
			if (recloseStep != oldRecloseStep) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP, oldRecloseStep, recloseStep));
			}
		}
		return recloseStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer basicGetRecloseStep() {
		return recloseStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRecloseStep(EA_Model.IEC61970.Domain.Integer newRecloseStep) {
		EA_Model.IEC61970.Domain.Integer oldRecloseStep = recloseStep;
		recloseStep = newRecloseStep;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP, oldRecloseStep, recloseStep));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY:
				if (resolve) return getRecloseDelay();
				return basicGetRecloseDelay();
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP:
				if (resolve) return getRecloseStep();
				return basicGetRecloseStep();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY:
				setRecloseDelay((Seconds)newValue);
				return;
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP:
				setRecloseStep((EA_Model.IEC61970.Domain.Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY:
				setRecloseDelay((Seconds)null);
				return;
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP:
				setRecloseStep((EA_Model.IEC61970.Domain.Integer)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_DELAY:
				return recloseDelay != null;
			case ProtectionPackage.RECLOSE_SEQUENCE__RECLOSE_STEP:
				return recloseStep != null;
		}
		return super.eIsSet(featureID);
	}

} //RecloseSequenceImpl
